package com.cp_smss.util;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;

import com.cp_smss.model.User;

public class Authorizer {
	
	public static boolean authorize(HttpServletRequest request,int role){
		User user = (User)request.getSession().getAttribute("User");
		return null != user && role == user.getRole()?true:false;
	}
	
	public static boolean mutiAuthorize(HttpServletRequest request,HashMap<Integer, Integer> roles){
		User user = (User)request.getSession().getAttribute("User");
		return null != roles.get(user.getRole())?true:false;
	}
	
}